
// 网站的优先访问 - 首屏加载速度  -路由懒加载 - 将文件进行分割，让对应的路由地址每次只加载少量的JS和css
// vue加载的模块换编辑工具 webpack 提供 ()=>{ return import(path) } 构成函数，该函数可以在webpack运行时
// 分解文件

import LoginView from '@/views/LoginView/LoginView.vue'
import HomeView from '@/views/HomeView/HomeView.vue'
import WelcomeView from '@/views/HomeView/pages/WelcomeView.vue'
import UsersView from '@/views/HomeView/pages/UsersView.vue'
import RightsView from '@/views/HomeView/pages/RightsView.vue'
import RolesView from '@/views/HomeView/pages/RolesView.vue'
import CategoriesView from '@/views/HomeView/pages/CategoriesView.vue'
import GoodsLayout from '@/views/HomeView/pages/goods/LayoutView.vue'
import GoodsView from '@/views/HomeView/pages/goods/GoodsView.vue'
import AddGoods from '@/views/HomeView/pages/goods/AddGoods.vue'
import NotFound from '@/views/HomeView/pages/NotFound.vue'

export default [
    {
        path: '/',
        name: 'login',
        component: LoginView
    },
    {
        path: '/home',
        name: 'home',
        component: HomeView,
        children:[
            {
                path:"welcome",
                name:"welcome",
                component:WelcomeView,
                meta:{
                    names:[
                        {title:"首页",name:"home"},
                        {title:"数据统计"}
                    ]
                }
            },
            {
                path:"users",
                name:"users",
                component:UsersView,
                meta:{
                    names:[
                        {title:"首页",name:"home"},
                        {title:"用户管理"},
                        {title:"用户列表"},
                    ]
                }
            },
            {
                path:"rights",
                name:"rights",
                component:RightsView,
                meta:{
                    names:[
                        {title:"首页",name:"home"},
                        {title:"权限管理"},
                        {title:"权限列表"},
                    ]
                }
            },
            {
                path:"roles",
                name:"roles",
                component:RolesView,
                meta:{
                    names:[
                        {title:"首页",name:"home"},
                        {title:"权限管理"},
                        {title:"角色列表"},
                    ]
                }
            },
            {
                path:"categories",
                name:"categories",
                component:CategoriesView,
                meta:{
                    names:[
                        {title:"首页",name:"home"},
                        {title:"商品管理"},
                        {title:"商品分类"},
                    ]
                }
            },
            {
                path:"goods",
                component:GoodsLayout,
                children:[
                    {
                        path:"",
                        name:"goods",
                        component:GoodsView,
                        meta:{
                            names:[
                                {title:"首页",name:"home"},
                                {title:"商品管理"},
                                {title:"商品列表"},
                            ]
                        }
                    },
                    {
                        path:"add",
                        name:"add",
                        component:AddGoods,
                        meta:{
                            names:[
                                {title:"首页",name:"home"},
                                {title:"商品管理"},
                                {title:"商品列表"},
                                {title:"商品添加"},
                            ]
                        }
                    },
                ]
            },
            // {
            //     path:"goods",
            //     name:"goods",
            //     component:GoodsView,
            //     meta:{
            //         names:[
            //             {title:"首页",name:"home"},
            //             {title:"商品管理"},
            //             {title:"商品列表"},
            //         ]
            //     }
            // },
            // {
            //     path:"goods/add",
            //     name:"add",
            //     component:AddGoods,
            //     meta:{
            //         names:[
            //             {title:"首页",name:"home"},
            //             {title:"商品管理"},
            //             {title:"商品列表"},
            //             {title:"商品添加"},
            //         ]
            //     }
            // },
            {
                path:"*",
                component:NotFound
            }
        ]
    },
    {
        path:"*",
        redirect:"/"
    }
]